<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>fdk-aac: Library Usage</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">fdk-aac
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="PageDoc"><div class="header">
  <div class="headertitle">
<div class="title">Library Usage </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="InterfaceDescritpion"></a>
API Description</h1>
<p>All API header files are located in the folder /include of the release package. The contents of each file is described in detail in this document. All header files are provided for usage in specific C/C++ programs. The main AAC decoder library API functions are located in <a class="el" href="aacdecoder__lib_8h.html" title="FDK AAC decoder library interface header file.">aacdecoder_lib.h</a> header file.</p>
<h1><a class="anchor" id="Calling_Sequence"></a>
Calling Sequence</h1>
<p>The following sequence is necessary for proper decoding of ISO/MPEG-2/4 AAC, HE-AAC v2, or MPEG-D USAC bitstreams. In the following description, input stream read and output write function details are left out, since they may be implemented in a variety of configurations depending on the user's specific requirements.</p>
<ol type="1">
<li>Call <a class="el" href="aacdecoder__lib_8h.html#ac8580fe563e79afe695d7b0b32ea0fed" title="Open an AAC decoder instance.">aacDecoder_Open()</a> to open and retrieve a handle to a new AAC decoder instance.<div class="fragment"><div class="line">aacDecoderInfo = <a class="code" href="aacdecoder__lib_8h.html#ac8580fe563e79afe695d7b0b32ea0fed">aacDecoder_Open</a>(transportType, nrOfLayers);</div>
<div class="ttc" id="aaacdecoder__lib_8h_html_ac8580fe563e79afe695d7b0b32ea0fed"><div class="ttname"><a href="aacdecoder__lib_8h.html#ac8580fe563e79afe695d7b0b32ea0fed">aacDecoder_Open</a></div><div class="ttdeci">LINKSPEC_H HANDLE_AACDECODER aacDecoder_Open(TRANSPORT_TYPE transportFmt, UINT nrOfLayers)</div><div class="ttdoc">Open an AAC decoder instance.</div><div class="ttdef"><b>Definition:</b> aacdecoder_lib.cpp:941</div></div>
</div><!-- fragment --></li>
<li>If out-of-band config data (Audio Specific Config (ASC) or Stream Mux Config (SMC)) is available, call <a class="el" href="aacdecoder__lib_8h.html#a6016435b8679d2793078b10ecaf3d05d" title="Explicitly configure the decoder by passing a raw AudioSpecificConfig (ASC) or a StreamMuxConfig (SMC...">aacDecoder_ConfigRaw()</a> to pass this data to the decoder before beginning the decoding process. If this data is not available in advance, the decoder will configure itself while decoding, during the <a class="el" href="aacdecoder__lib_8h.html#a245a0e4176fb886d890a86627c55bb24" title="Decode one audio frame.">aacDecoder_DecodeFrame()</a> function call.</li>
<li>Begin decoding loop. <div class="fragment"><div class="line"><span class="keywordflow">do</span> {</div>
</div><!-- fragment --></li>
<li>Read data from bitstream file or stream buffer in to the driver program working memory (a client-supplied input buffer "inBuffer" in framework). This buffer will be used to load AAC bitstream data to the decoder. Only when all data in this buffer has been processed will the decoder signal an empty buffer.</li>
<li>Call <a class="el" href="aacdecoder__lib_8h.html#a6d508fce68c364f5dabc9195e701ecf8" title="Fill AAC decoder&#39;s internal input buffer with bitstream data from the external input buffer....">aacDecoder_Fill()</a> to fill the decoder's internal bitstream input buffer with the client-supplied bitstream input buffer. Note, if the data loaded in to the internal buffer is not sufficient to decode a frame, <a class="el" href="aacdecoder__lib_8h.html#a245a0e4176fb886d890a86627c55bb24" title="Decode one audio frame.">aacDecoder_DecodeFrame()</a> will return <a class="el" href="aacdecoder__lib_8h.html#afbc7e8b4f1613dfd8cb91b681eeb9d41ad8e91a23786bc032e507dfbd036f63c4">AAC_DEC_NOT_ENOUGH_BITS</a> until a sufficient amount of data is loaded in to the internal buffer. For streaming formats (ADTS, LOAS), it is acceptable to load more than one frame to the decoder. However, for packed based formats, only one frame may be loaded to the decoder per <a class="el" href="aacdecoder__lib_8h.html#a245a0e4176fb886d890a86627c55bb24" title="Decode one audio frame.">aacDecoder_DecodeFrame()</a> call. For least amount of communication delay, fill and decode should be performed on a frame by frame basis.<div class="fragment"><div class="line">    ErrorStatus = <a class="code" href="aacdecoder__lib_8h.html#a6d508fce68c364f5dabc9195e701ecf8">aacDecoder_Fill</a>(aacDecoderInfo, inBuffer, bytesRead,</div>
<div class="line">bytesValid); </div>
<div class="ttc" id="aaacdecoder__lib_8h_html_a6d508fce68c364f5dabc9195e701ecf8"><div class="ttname"><a href="aacdecoder__lib_8h.html#a6d508fce68c364f5dabc9195e701ecf8">aacDecoder_Fill</a></div><div class="ttdeci">LINKSPEC_H AAC_DECODER_ERROR aacDecoder_Fill(HANDLE_AACDECODER self, UCHAR *pBuffer[], const UINT bufferSize[], UINT *bytesValid)</div><div class="ttdoc">Fill AAC decoder's internal input buffer with bitstream data from the external input buffer....</div><div class="ttdef"><b>Definition:</b> aacdecoder_lib.cpp:1050</div></div>
</div><!-- fragment --></li>
<li>Call <a class="el" href="aacdecoder__lib_8h.html#a245a0e4176fb886d890a86627c55bb24" title="Decode one audio frame.">aacDecoder_DecodeFrame()</a>. This function decodes one frame and writes decoded PCM audio data to a client-supplied buffer. It is the client's responsibility to allocate a buffer which is large enough to hold the decoded output data.<div class="fragment"><div class="line"> ErrorStatus = <a class="code" href="aacdecoder__lib_8h.html#a245a0e4176fb886d890a86627c55bb24">aacDecoder_DecodeFrame</a>(aacDecoderInfo,</div>
<div class="line">TimeData, OUT_BUF_SIZE, flags); </div>
<div class="ttc" id="aaacdecoder__lib_8h_html_a245a0e4176fb886d890a86627c55bb24"><div class="ttname"><a href="aacdecoder__lib_8h.html#a245a0e4176fb886d890a86627c55bb24">aacDecoder_DecodeFrame</a></div><div class="ttdeci">LINKSPEC_H AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData, const INT timeDataSize, const UINT flags)</div><div class="ttdoc">Decode one audio frame.</div><div class="ttdef"><b>Definition:</b> aacdecoder_lib.cpp:1136</div></div>
</div><!-- fragment --> If the bitstream configuration (number of channels, sample rate, frame size) is not known a priori, you may call <a class="el" href="aacdecoder__lib_8h.html#a60aa42cb3ddc804b44ce61d877d0501e" title="Get CStreamInfo handle from decoder.">aacDecoder_GetStreamInfo()</a> to retrieve a structure that contains this information. You may use this data to initialize an audio output device.<div class="fragment"><div class="line">p_si = <a class="code" href="aacdecoder__lib_8h.html#a60aa42cb3ddc804b44ce61d877d0501e">aacDecoder_GetStreamInfo</a>(aacDecoderInfo);</div>
<div class="ttc" id="aaacdecoder__lib_8h_html_a60aa42cb3ddc804b44ce61d877d0501e"><div class="ttname"><a href="aacdecoder__lib_8h.html#a60aa42cb3ddc804b44ce61d877d0501e">aacDecoder_GetStreamInfo</a></div><div class="ttdeci">LINKSPEC_H CStreamInfo * aacDecoder_GetStreamInfo(HANDLE_AACDECODER self)</div><div class="ttdoc">Get CStreamInfo handle from decoder.</div><div class="ttdef"><b>Definition:</b> aacdecoder_lib.cpp:2066</div></div>
</div><!-- fragment --></li>
<li>Repeat steps 5 to 7 until no data is available to decode any more, or in case of error.<div class="fragment"><div class="line"> } <span class="keywordflow">while</span> (bytesRead[0] &gt; 0 || doFlush || doBsFlush ||</div>
<div class="line">forceContinue); </div>
</div><!-- fragment --></li>
<li>Call <a class="el" href="aacdecoder__lib_8h.html#acca8f4cf9757885d6c654de37a43072f" title="De-allocate all resources of an AAC decoder instance.">aacDecoder_Close()</a> to de-allocate all AAC decoder and transport layer structures.<div class="fragment"><div class="line"><a class="code" href="aacdecoder__lib_8h.html#acca8f4cf9757885d6c654de37a43072f">aacDecoder_Close</a>(aacDecoderInfo); </div>
<div class="ttc" id="aaacdecoder__lib_8h_html_acca8f4cf9757885d6c654de37a43072f"><div class="ttname"><a href="aacdecoder__lib_8h.html#acca8f4cf9757885d6c654de37a43072f">aacDecoder_Close</a></div><div class="ttdeci">LINKSPEC_H void aacDecoder_Close(HANDLE_AACDECODER self)</div><div class="ttdoc">De-allocate all resources of an AAC decoder instance.</div><div class="ttdef"><b>Definition:</b> aacdecoder_lib.cpp:2037</div></div>
</div><!-- fragment --></li>
</ol>
<p></p>
<p></p>
<p></p>
<h2><a class="anchor" id="Error_Concealment_Sequence"></a>
Error Concealment Sequence</h2>
<p>There are different strategies to handle bit stream errors. Depending on the system properties the product designer might choose to take different actions in case a bit error occurs. In many cases the decoder might be able to do reasonable error concealment without the need of any additional actions from the system. But in some cases its not even possible to know how many decoded PCM output samples are required to fill the gap due to the data error, then the software surrounding the decoder must deal with the situation. The most simple way would be to just stop audio playback and resume once enough bit stream data and/or buffered output samples are available. More sophisticated designs might also be able to deal with sender/receiver clock drifts or data drop outs by using a closed loop control of FIFO fulness levels. The chosen strategy depends on the final product requirements.</p>
<p>The error concealment sequence diagram illustrates the general execution paths for error handling.</p>
<p>The macro <a class="el" href="aacdecoder__lib_8h.html#af59d78a4583ca81ccb2675dce592b812">IS_OUTPUT_VALID(err)</a> can be used to identify if the audio output buffer contains valid audio either from error free bit stream data or successful error concealment. In case the result is false, the decoder output buffer does not contain meaningful audio samples and should not be passed to any output as it is. Most likely in case that a continuous audio output PCM stream is required, the output buffer must be filled with audio data from the calling framework. This might be e.g. an appropriate number of samples all zero.</p>
<p>If error code <a class="el" href="aacdecoder__lib_8h.html#afbc7e8b4f1613dfd8cb91b681eeb9d41adbb894fd8e900c4993f57ae88f8aee1a">AAC_DEC_TRANSPORT_SYNC_ERROR</a> is returned by the decoder, under some particular conditions it is possible to estimate lost frames due to the bit stream error. In that case the bit stream is required to have a constant bitrate, and compatible transport type. Audio samples for the lost frames can be obtained by calling <a class="el" href="aacdecoder__lib_8h.html#a245a0e4176fb886d890a86627c55bb24" title="Decode one audio frame.">aacDecoder_DecodeFrame()</a> with flag <a class="el" href="aacdecoder__lib_8h.html#ae09502f250437ee519971ca3a95ac9e0">AACDEC_CONCEAL</a> set n-times where n is the count of lost frames. Please note that the decoder has to have encountered valid configuration data at least once to be able to generate concealed data, because at the minimum the sampling rate, frame size and amount of audio channels needs to be known.</p>
<p>If it is not possible to get an estimation of lost frames then a constant fullness of the audio output buffer can be achieved by implementing different FIFO control techniques e.g. just stop taking of samples from the buffer to avoid underflow or stop filling new data to the buffer to avoid overflow. But this techniques are out of scope of this document.</p>
<p>For a detailed description of a specific error code please refer also to <a class="el" href="aacdecoder__lib_8h.html#afbc7e8b4f1613dfd8cb91b681eeb9d41" title="AAC decoder error codes.">AAC_DECODER_ERROR</a>.</p>
<h1><a class="anchor" id="BufferSystem"></a>
Buffer System</h1>
<p>There are three main buffers in an AAC decoder application. One external input buffer to hold bitstream data from file I/O or elsewhere, one decoder-internal input buffer, and one to hold the decoded output PCM sample data. In resource limited applications, the output buffer may be reused as an external input buffer prior to the subsequence <a class="el" href="aacdecoder__lib_8h.html#a6d508fce68c364f5dabc9195e701ecf8" title="Fill AAC decoder&#39;s internal input buffer with bitstream data from the external input buffer....">aacDecoder_Fill()</a> function call.</p>
<p>To feed the data to the decoder-internal input buffer, use the function <a class="el" href="aacdecoder__lib_8h.html#a6d508fce68c364f5dabc9195e701ecf8" title="Fill AAC decoder&#39;s internal input buffer with bitstream data from the external input buffer....">aacDecoder_Fill()</a>. This function returns important information regarding the number of bytes in the external input buffer that have not yet been copied into the internal input buffer (variable bytesValid). Once the external buffer has been fully copied, it can be completely re-filled again. In case you wish to refill the buffer while there are unprocessed bytes (bytesValid is unequal 0), you should preserve the unconsumed data. However, we recommend to refill the buffer only when bytesValid returns 0.</p>
<p>The bytesValid parameter is an input and output parameter to the FDK decoder. As an input, it signals how many valid bytes are available in the external buffer. After consumption of the external buffer using <a class="el" href="aacdecoder__lib_8h.html#a6d508fce68c364f5dabc9195e701ecf8" title="Fill AAC decoder&#39;s internal input buffer with bitstream data from the external input buffer....">aacDecoder_Fill()</a> function, the bytesValid parameter indicates if any of the bytes in the external buffer were not consumed.</p>
<p></p>
<h1><a class="anchor" id="InterfaceDescription"></a>
API Files</h1>
<p>All API header files are located in the folder /include of the release package. All header files are provided for usage in C/C++ programs. The AAC encoder library API functions are located in <a class="el" href="aacenc__lib_8h_source.html">aacenc_lib.h</a>.</p>
<h1><a class="anchor" id="CallingSequence"></a>
Calling Sequence</h1>
<p>For encoding of ISO/MPEG-2/4 AAC bitstreams the following sequence is mandatory. Input read and output write functions as well as the corresponding open and close functions are left out, since they may be implemented differently according to the user's specific requirements. The example implementation uses file-based input/output.</p>
<ol type="1">
<li>Call aacEncOpen() to allocate encoder instance with required <a class="el" href="_l_i_b_u_s_e.html#encOpen">configuration</a>.<div class="fragment"><div class="line"> <a class="code" href="struct_a_a_c_e_n_c_o_d_e_r.html">HANDLE_AACENCODER</a> hAacEncoder = NULL; <span class="keywordflow">if</span> ( (ErrorStatus =</div>
<div class="line">aacEncOpen(&amp;hAacEncoder,0,0)) != AACENC_OK ) { </div>
<div class="ttc" id="astruct_a_a_c_e_n_c_o_d_e_r_html"><div class="ttname"><a href="struct_a_a_c_e_n_c_o_d_e_r.html">AACENCODER</a></div><div class="ttdef"><b>Definition:</b> aacenc_lib.cpp:230</div></div>
</div><!-- fragment --></li>
<li>Call aacEncoder_SetParam() for each parameter to be set. AOT, samplingrate, channelMode, bitrate and transport type are <a class="el" href="_l_i_b_u_s_e.html#encParams">mandatory</a>.<div class="fragment"><div class="line">ErrorStatus = aacEncoder_SetParam(hAacEncoder, parameter, value);</div>
</div><!-- fragment --></li>
<li>Call aacEncEncode() with NULL parameters to <a class="el" href="_l_i_b_u_s_e.html#encReconf">initialize</a> encoder instance with present parameter set.<div class="fragment"><div class="line"> ErrorStatus =</div>
<div class="line">aacEncEncode(hAacEncoder, NULL, NULL, NULL, NULL); </div>
</div><!-- fragment --></li>
<li>Call aacEncInfo() to retrieve a configuration data block to be transmitted out of band. This is required when using RFC3640 or RFC3016 like transport. <div class="fragment"><div class="line"><a class="code" href="struct_a_a_c_e_n_c___info_struct.html">AACENC_InfoStruct</a> encInfo;</div>
<div class="line">aacEncInfo(hAacEncoder, &amp;encInfo);</div>
<div class="ttc" id="astruct_a_a_c_e_n_c___info_struct_html"><div class="ttname"><a href="struct_a_a_c_e_n_c___info_struct.html">AACENC_InfoStruct</a></div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1066</div></div>
</div><!-- fragment --></li>
<li>Encode input audio data in loop. <div class="fragment"><div class="line"><span class="keywordflow">do</span></div>
<div class="line">{</div>
</div><!-- fragment --> Feed <a class="el" href="_l_i_b_u_s_e.html#feedInBuf">input buffer</a> with new audio data and provide input/output <a class="el" href="_l_i_b_u_s_e.html#bufDes">arguments</a> to aacEncEncode().<div class="fragment"><div class="line"> ErrorStatus =</div>
<div class="line">aacEncEncode(hAacEncoder, &amp;inBufDesc, &amp;outBufDesc, &amp;inargs, &amp;outargs); </div>
</div><!-- fragment --> Write <a class="el" href="_l_i_b_u_s_e.html#writeOutData">output data</a> to file or audio device. <div class="fragment"><div class="line">} <span class="keywordflow">while</span> (ErrorStatus==AACENC_OK);</div>
</div><!-- fragment --></li>
<li>Call aacEncClose() and destroy encoder instance. <div class="fragment"><div class="line">aacEncClose(&amp;hAacEncoder);</div>
</div><!-- fragment --></li>
</ol>
<h1><a class="anchor" id="encOpen"></a>
Encoder Instance Allocation</h1>
<p>The assignment of the aacEncOpen() function is very flexible and can be used in the following way.</p><ul>
<li>If the amount of memory consumption is not an issue, the encoder instance can be allocated for the maximum number of possible audio channels (for example 6 or 8) with the full functional range supported by the library. This is the default open procedure for the AAC encoder if memory consumption does not need to be minimized.<div class="fragment"><div class="line">aacEncOpen(&amp;hAacEncoder,0,0) </div>
</div><!-- fragment --></li>
<li>If the required MPEG-4 AOTs do not call for the full functional range of the library, encoder modules can be allocated selectively.<pre class="fragment">------------------------------------------------------
 AAC | SBR |  PS | MD |         FLAGS         | value
-----+-----+-----+----+-----------------------+-------
  X  |  -  |  -  |  - | (0x01)                |  0x01
  X  |  X  |  -  |  - | (0x01|0x02)           |  0x03
  X  |  X  |  X  |  - | (0x01|0x02|0x04)      |  0x07
  X  |  -  |  -  |  X | (0x01          |0x10) |  0x11
  X  |  X  |  -  |  X | (0x01|0x02     |0x10) |  0x13
  X  |  X  |  X  |  X | (0x01|0x02|0x04|0x10) |  0x17
------------------------------------------------------
 - AAC: Allocate AAC Core Encoder module.
 - SBR: Allocate Spectral Band Replication module.
 - PS: Allocate Parametric Stereo module.
 - MD: Allocate Meta Data module within AAC encoder.
</pre> <div class="fragment"><div class="line">aacEncOpen(&amp;hAacEncoder,value,0) </div>
</div><!-- fragment --></li>
<li>Specifying the maximum number of channels to be supported in the encoder instance can be done as follows.<ul>
<li>For example allocate an encoder instance which supports 2 channels for all supported AOTs. The library itself may be capable of encoding up to 6 or 8 channels but in this example only 2 channel encoding is required and thus only buffers for 2 channels are allocated to save data memory.<div class="fragment"><div class="line">aacEncOpen(&amp;hAacEncoder,0,2) </div>
</div><!-- fragment --></li>
<li>Additionally the maximum number of supported channels in the SBR module can be denoted separately.<br  />
 In this example the encoder instance provides a maximum of 6 channels out of which up to 2 channels support SBR. This encoder instance can produce for example 5.1 channel AAC-LC streams or stereo HE-AAC (v2) streams. HE-AAC 5.1 multi channel is not possible since only 2 out of 6 channels support SBR, which saves data memory.<div class="fragment"><div class="line">aacEncOpen(&amp;hAacEncoder,0,6|(2&lt;&lt;8))</div>
</div><!-- fragment --> <br  />
 </li>
</ul>
</li>
</ul>
<h1><a class="anchor" id="bufDes"></a>
Input/Output Arguments</h1>
<h2><a class="anchor" id="allocIOBufs"></a>
Provide Buffer Descriptors</h2>
<p>In the present encoder API, the input and output buffers are described with <a class="el" href="struct_a_a_c_e_n_c___buf_desc.html">buffer descriptors</a>. This mechanism allows a flexible handling of input and output buffers without impact to the actual encoding call. Optional buffers are necessary e.g. for ancillary data, meta data input or additional output buffers describing superframing data in DAB+ or DRM+.<br  />
 At least one input buffer for audio input data and one output buffer for bitstream data must be allocated. The input buffer size can be a user defined multiple of the number of input channels. PCM input data will be copied from the user defined PCM buffer to an internal input buffer and so input data can be less than one AAC audio frame. The output buffer size should be 6144 bits per channel excluding the LFE channel. If the output data does not fit into the provided buffer, an AACENC_ERROR will be returned by aacEncEncode().</p><div class="fragment"><div class="line"> <span class="keyword">static</span> <a class="code" href="machine__type_8h.html#ac024ad9a1e48a3e87d360d519d943512">INT_PCM</a></div>
<div class="line">inputBuffer[8*2048]; <span class="keyword">static</span> <a class="code" href="machine__type_8h.html#aed5a2dbe32af3a91203f0f5e8697e873">UCHAR</a>            ancillaryBuffer[50]; <span class="keyword">static</span></div>
<div class="line"><a class="code" href="struct_a_a_c_e_n_c___meta_data.html">AACENC_MetaData</a>  metaDataSetup; <span class="keyword">static</span> <a class="code" href="machine__type_8h.html#aed5a2dbe32af3a91203f0f5e8697e873">UCHAR</a>            outputBuffer[8192];</div>
<div class="ttc" id="amachine__type_8h_html_ac024ad9a1e48a3e87d360d519d943512"><div class="ttname"><a href="machine__type_8h.html#ac024ad9a1e48a3e87d360d519d943512">INT_PCM</a></div><div class="ttdeci">SHORT INT_PCM</div><div class="ttdef"><b>Definition:</b> machine_type.h:226</div></div>
<div class="ttc" id="amachine__type_8h_html_aed5a2dbe32af3a91203f0f5e8697e873"><div class="ttname"><a href="machine__type_8h.html#aed5a2dbe32af3a91203f0f5e8697e873">UCHAR</a></div><div class="ttdeci">unsigned char UCHAR</div><div class="ttdef"><b>Definition:</b> machine_type.h:190</div></div>
<div class="ttc" id="astruct_a_a_c_e_n_c___meta_data_html"><div class="ttname"><a href="struct_a_a_c_e_n_c___meta_data.html">AACENC_MetaData</a></div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1159</div></div>
</div><!-- fragment --><p>All input and output buffer must be clustered in input and output buffer arrays. </p><div class="fragment"><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span>* inBuffer[]        = { inputBuffer, ancillaryBuffer, &amp;metaDataSetup</div>
<div class="line">}; <span class="keyword">static</span> <a class="code" href="machine__type_8h.html#a4cf9af43a95c45c3d469658098dfbe1a">INT</a>   inBufferIds[]     = { IN_AUDIO_DATA, IN_ANCILLRY_DATA,</div>
<div class="line">IN_METADATA_SETUP }; <span class="keyword">static</span> <a class="code" href="machine__type_8h.html#a4cf9af43a95c45c3d469658098dfbe1a">INT</a>   inBufferSize[]    = { <span class="keyword">sizeof</span>(inputBuffer),</div>
<div class="line"><span class="keyword">sizeof</span>(ancillaryBuffer), <span class="keyword">sizeof</span>(metaDataSetup) }; <span class="keyword">static</span> <a class="code" href="machine__type_8h.html#a4cf9af43a95c45c3d469658098dfbe1a">INT</a>   inBufferElSize[]</div>
<div class="line">= { <span class="keyword">sizeof</span>(<a class="code" href="machine__type_8h.html#ac024ad9a1e48a3e87d360d519d943512">INT_PCM</a>), <span class="keyword">sizeof</span>(<a class="code" href="machine__type_8h.html#aed5a2dbe32af3a91203f0f5e8697e873">UCHAR</a>), <span class="keyword">sizeof</span>(<a class="code" href="struct_a_a_c_e_n_c___meta_data.html">AACENC_MetaData</a>) };</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span>* outBuffer[]       = { outputBuffer };</div>
<div class="line"><span class="keyword">static</span> <a class="code" href="machine__type_8h.html#a4cf9af43a95c45c3d469658098dfbe1a">INT</a>   outBufferIds[]    = { OUT_BITSTREAM_DATA };</div>
<div class="line"><span class="keyword">static</span> <a class="code" href="machine__type_8h.html#a4cf9af43a95c45c3d469658098dfbe1a">INT</a>   outBufferSize[]   = { <span class="keyword">sizeof</span>(outputBuffer) };</div>
<div class="line"><span class="keyword">static</span> <a class="code" href="machine__type_8h.html#a4cf9af43a95c45c3d469658098dfbe1a">INT</a>   outBufferElSize[] = { <span class="keyword">sizeof</span>(<a class="code" href="machine__type_8h.html#aed5a2dbe32af3a91203f0f5e8697e873">UCHAR</a>) };</div>
<div class="ttc" id="amachine__type_8h_html_a4cf9af43a95c45c3d469658098dfbe1a"><div class="ttname"><a href="machine__type_8h.html#a4cf9af43a95c45c3d469658098dfbe1a">INT</a></div><div class="ttdeci">signed int INT</div><div class="ttdef"><b>Definition:</b> machine_type.h:176</div></div>
</div><!-- fragment --><p>Allocate buffer descriptors </p><div class="fragment"><div class="line"><a class="code" href="struct_a_a_c_e_n_c___buf_desc.html">AACENC_BufDesc</a> inBufDesc;</div>
<div class="line"><a class="code" href="struct_a_a_c_e_n_c___buf_desc.html">AACENC_BufDesc</a> outBufDesc;</div>
<div class="ttc" id="astruct_a_a_c_e_n_c___buf_desc_html"><div class="ttname"><a href="struct_a_a_c_e_n_c___buf_desc.html">AACENC_BufDesc</a></div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1107</div></div>
</div><!-- fragment --><p>Initialize input buffer descriptor </p><div class="fragment"><div class="line">inBufDesc.<a class="code" href="struct_a_a_c_e_n_c___buf_desc.html#a324387bb8e5f44650c6e17c209bb05a9">numBufs</a>            = <span class="keyword">sizeof</span>(inBuffer)/<span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*);</div>
<div class="line">inBufDesc.<a class="code" href="struct_a_a_c_e_n_c___buf_desc.html#ab13b6a5c10505c3defd8bb1c19eac81d">bufs</a>              = (<span class="keywordtype">void</span>**)&amp;inBuffer;</div>
<div class="line">inBufDesc.<a class="code" href="struct_a_a_c_e_n_c___buf_desc.html#a2c09424d3a61cdbdb80c8d9ebb42ce71">bufferIdentifiers</a> = inBufferIds;</div>
<div class="line">inBufDesc.<a class="code" href="struct_a_a_c_e_n_c___buf_desc.html#ace97d9ab9ad2f7b24041ee253ad7372f">bufSizes</a>          = inBufferSize;</div>
<div class="line">inBufDesc.<a class="code" href="struct_a_a_c_e_n_c___buf_desc.html#ac32946f846b95272038017687a96f2c1">bufElSizes</a>        = inBufferElSize;</div>
<div class="ttc" id="astruct_a_a_c_e_n_c___buf_desc_html_a2c09424d3a61cdbdb80c8d9ebb42ce71"><div class="ttname"><a href="struct_a_a_c_e_n_c___buf_desc.html#a2c09424d3a61cdbdb80c8d9ebb42ce71">AACENC_BufDesc::bufferIdentifiers</a></div><div class="ttdeci">INT * bufferIdentifiers</div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1110</div></div>
<div class="ttc" id="astruct_a_a_c_e_n_c___buf_desc_html_a324387bb8e5f44650c6e17c209bb05a9"><div class="ttname"><a href="struct_a_a_c_e_n_c___buf_desc.html#a324387bb8e5f44650c6e17c209bb05a9">AACENC_BufDesc::numBufs</a></div><div class="ttdeci">INT numBufs</div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1108</div></div>
<div class="ttc" id="astruct_a_a_c_e_n_c___buf_desc_html_ab13b6a5c10505c3defd8bb1c19eac81d"><div class="ttname"><a href="struct_a_a_c_e_n_c___buf_desc.html#ab13b6a5c10505c3defd8bb1c19eac81d">AACENC_BufDesc::bufs</a></div><div class="ttdeci">void ** bufs</div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1109</div></div>
<div class="ttc" id="astruct_a_a_c_e_n_c___buf_desc_html_ac32946f846b95272038017687a96f2c1"><div class="ttname"><a href="struct_a_a_c_e_n_c___buf_desc.html#ac32946f846b95272038017687a96f2c1">AACENC_BufDesc::bufElSizes</a></div><div class="ttdeci">INT * bufElSizes</div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1113</div></div>
<div class="ttc" id="astruct_a_a_c_e_n_c___buf_desc_html_ace97d9ab9ad2f7b24041ee253ad7372f"><div class="ttname"><a href="struct_a_a_c_e_n_c___buf_desc.html#ace97d9ab9ad2f7b24041ee253ad7372f">AACENC_BufDesc::bufSizes</a></div><div class="ttdeci">INT * bufSizes</div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1112</div></div>
</div><!-- fragment --><p>Initialize output buffer descriptor </p><div class="fragment"><div class="line">outBufDesc.<a class="code" href="struct_a_a_c_e_n_c___buf_desc.html#a324387bb8e5f44650c6e17c209bb05a9">numBufs</a>           = <span class="keyword">sizeof</span>(outBuffer)/<span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*);</div>
<div class="line">outBufDesc.<a class="code" href="struct_a_a_c_e_n_c___buf_desc.html#ab13b6a5c10505c3defd8bb1c19eac81d">bufs</a>              = (<span class="keywordtype">void</span>**)&amp;outBuffer;</div>
<div class="line">outBufDesc.<a class="code" href="struct_a_a_c_e_n_c___buf_desc.html#a2c09424d3a61cdbdb80c8d9ebb42ce71">bufferIdentifiers</a> = outBufferIds;</div>
<div class="line">outBufDesc.<a class="code" href="struct_a_a_c_e_n_c___buf_desc.html#ace97d9ab9ad2f7b24041ee253ad7372f">bufSizes</a>          = outBufferSize;</div>
<div class="line">outBufDesc.<a class="code" href="struct_a_a_c_e_n_c___buf_desc.html#ac32946f846b95272038017687a96f2c1">bufElSizes</a>        = outBufferElSize;</div>
</div><!-- fragment --><h2><a class="anchor" id="argLists"></a>
Provide Input/Output Argument Lists</h2>
<p>The input and output arguments of an aacEncEncode() call are described in argument structures.</p><div class="fragment"><div class="line"><a class="code" href="struct_a_a_c_e_n_c___in_args.html">AACENC_InArgs</a>     inargs; <a class="code" href="struct_a_a_c_e_n_c___out_args.html">AACENC_OutArgs</a>    outargs;</div>
<div class="ttc" id="astruct_a_a_c_e_n_c___in_args_html"><div class="ttname"><a href="struct_a_a_c_e_n_c___in_args.html">AACENC_InArgs</a></div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1120</div></div>
<div class="ttc" id="astruct_a_a_c_e_n_c___out_args_html"><div class="ttname"><a href="struct_a_a_c_e_n_c___out_args.html">AACENC_OutArgs</a></div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1130</div></div>
</div><!-- fragment --><h1><a class="anchor" id="feedInBuf"></a>
Feed Input Buffer</h1>
<p>The input buffer should be handled as a modulo buffer. New audio data in the form of pulse-code- modulated samples (PCM) must be read from external and be fed to the input buffer depending on its fill level. The required sample bitrate (represented by the data type INT_PCM which is 16, 24 or 32 bits wide) is fixed and depends on library configuration (usually 16 bit).</p><div class="fragment"><div class="line"> inargs.<a class="code" href="struct_a_a_c_e_n_c___in_args.html#aefc45c133d4f9775d8d0aadf56302ae4">numInSamples</a></div>
<div class="line">+= WAV_InputRead ( wavIn, &amp;inputBuffer[inargs.<a class="code" href="struct_a_a_c_e_n_c___in_args.html#aefc45c133d4f9775d8d0aadf56302ae4">numInSamples</a>],</div>
<div class="line">                                       FDKmin(encInfo.<a class="code" href="struct_a_a_c_e_n_c___info_struct.html#ac786a4ebf4dc7f2357cbc142265f5dd8">inputChannels</a>*encInfo.<a class="code" href="struct_a_a_c_e_n_c___info_struct.html#a993149bc5985d79c40d6e96a2d90a228">frameLength</a>,</div>
<div class="line">                                              <span class="keyword">sizeof</span>(inputBuffer) /</div>
<div class="line">                                              <span class="keyword">sizeof</span>(<a class="code" href="machine__type_8h.html#ac024ad9a1e48a3e87d360d519d943512">INT_PCM</a>)-inargs.<a class="code" href="struct_a_a_c_e_n_c___in_args.html#aefc45c133d4f9775d8d0aadf56302ae4">numInSamples</a>),</div>
<div class="line">                                       SAMPLE_BITS</div>
<div class="line">                                     );</div>
<div class="ttc" id="astruct_a_a_c_e_n_c___in_args_html_aefc45c133d4f9775d8d0aadf56302ae4"><div class="ttname"><a href="struct_a_a_c_e_n_c___in_args.html#aefc45c133d4f9775d8d0aadf56302ae4">AACENC_InArgs::numInSamples</a></div><div class="ttdeci">INT numInSamples</div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1121</div></div>
<div class="ttc" id="astruct_a_a_c_e_n_c___info_struct_html_a993149bc5985d79c40d6e96a2d90a228"><div class="ttname"><a href="struct_a_a_c_e_n_c___info_struct.html#a993149bc5985d79c40d6e96a2d90a228">AACENC_InfoStruct::frameLength</a></div><div class="ttdeci">UINT frameLength</div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1081</div></div>
<div class="ttc" id="astruct_a_a_c_e_n_c___info_struct_html_ac786a4ebf4dc7f2357cbc142265f5dd8"><div class="ttname"><a href="struct_a_a_c_e_n_c___info_struct.html#ac786a4ebf4dc7f2357cbc142265f5dd8">AACENC_InfoStruct::inputChannels</a></div><div class="ttdeci">UINT inputChannels</div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1078</div></div>
</div><!-- fragment --><p>After the encoder's internal buffer is fed with incoming audio samples, and aacEncEncode() processed the new input data, update/move remaining samples in input buffer, simulating a modulo buffer:</p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (outargs.<a class="code" href="struct_a_a_c_e_n_c___out_args.html#ad4d8784f4d5504a5f87ef44af1e7b6db">numInSamples</a>&gt;0) {</div>
<div class="line">    <a class="code" href="generic_stds_8h.html#a8089a27d36590fb506d45223ed08ca45">FDKmemmove</a>( inputBuffer,</div>
<div class="line">                &amp;inputBuffer[outargs.<a class="code" href="struct_a_a_c_e_n_c___out_args.html#ad4d8784f4d5504a5f87ef44af1e7b6db">numInSamples</a>],</div>
<div class="line">                <span class="keyword">sizeof</span>(<a class="code" href="machine__type_8h.html#ac024ad9a1e48a3e87d360d519d943512">INT_PCM</a>)*(inargs.<a class="code" href="struct_a_a_c_e_n_c___in_args.html#aefc45c133d4f9775d8d0aadf56302ae4">numInSamples</a>-outargs.<a class="code" href="struct_a_a_c_e_n_c___out_args.html#ad4d8784f4d5504a5f87ef44af1e7b6db">numInSamples</a>) );</div>
<div class="line">    inargs.<a class="code" href="struct_a_a_c_e_n_c___in_args.html#aefc45c133d4f9775d8d0aadf56302ae4">numInSamples</a> -= outargs.<a class="code" href="struct_a_a_c_e_n_c___out_args.html#ad4d8784f4d5504a5f87ef44af1e7b6db">numInSamples</a>;</div>
<div class="line">}</div>
<div class="ttc" id="ageneric_stds_8h_html_a8089a27d36590fb506d45223ed08ca45"><div class="ttname"><a href="generic_stds_8h.html#a8089a27d36590fb506d45223ed08ca45">FDKmemmove</a></div><div class="ttdeci">void FDKmemmove(void *dst, const void *src, const UINT size)</div><div class="ttdef"><b>Definition:</b> genericStds.cpp:288</div></div>
<div class="ttc" id="astruct_a_a_c_e_n_c___out_args_html_ad4d8784f4d5504a5f87ef44af1e7b6db"><div class="ttname"><a href="struct_a_a_c_e_n_c___out_args.html#ad4d8784f4d5504a5f87ef44af1e7b6db">AACENC_OutArgs::numInSamples</a></div><div class="ttdeci">INT numInSamples</div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1133</div></div>
</div><!-- fragment --><h1><a class="anchor" id="writeOutData"></a>
Output Bitstream Data</h1>
<p>If any AAC bitstream data is available, write it to output file or device as follows.</p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (outargs.<a class="code" href="struct_a_a_c_e_n_c___out_args.html#aa08d19137d0dbd54d3d86f88a85eb149">numOutBytes</a>&gt;0) { <a class="code" href="generic_stds_8h.html#a3398ea13c8bee7151baecc71aab6c129">FDKfwrite</a>(outputBuffer,</div>
<div class="line">outargs.<a class="code" href="struct_a_a_c_e_n_c___out_args.html#aa08d19137d0dbd54d3d86f88a85eb149">numOutBytes</a>, 1, pOutFile);</div>
<div class="line">}</div>
<div class="ttc" id="ageneric_stds_8h_html_a3398ea13c8bee7151baecc71aab6c129"><div class="ttname"><a href="generic_stds_8h.html#a3398ea13c8bee7151baecc71aab6c129">FDKfwrite</a></div><div class="ttdeci">UINT FDKfwrite(const void *ptrf, INT size, UINT nmemb, FDKFILE *fp)</div><div class="ttdef"><b>Definition:</b> genericStds.cpp:336</div></div>
<div class="ttc" id="astruct_a_a_c_e_n_c___out_args_html_aa08d19137d0dbd54d3d86f88a85eb149"><div class="ttname"><a href="struct_a_a_c_e_n_c___out_args.html#aa08d19137d0dbd54d3d86f88a85eb149">AACENC_OutArgs::numOutBytes</a></div><div class="ttdeci">INT numOutBytes</div><div class="ttdef"><b>Definition:</b> aacenc_lib.h:1131</div></div>
</div><!-- fragment --><h1><a class="anchor" id="cfgMetaData"></a>
Meta Data Configuration</h1>
<p>If the present library is configured with Metadata support, it is possible to insert meta data side info into the generated audio bitstream while encoding.</p>
<p>To work with meta data the encoder instance has to be <a class="el" href="_l_i_b_u_s_e.html#encOpen">allocated</a> with meta data support. The meta data mode must be configured with the ::AACENC_METADATA_MODE parameter and aacEncoder_SetParam() function.</p><div class="fragment"><div class="line">aacEncoder_SetParam(hAacEncoder, AACENC_METADATA_MODE, 0-3); </div>
</div><!-- fragment --><p>This configuration indicates how to embed meta data into bitstrem. Either no insertion, MPEG or ETSI style. The meta data itself must be specified within the meta data setup structure <a class="el" href="struct_a_a_c_e_n_c___meta_data.html">AACENC_MetaData</a>.</p>
<p>Changing one of the <a class="el" href="struct_a_a_c_e_n_c___meta_data.html">AACENC_MetaData</a> setup parameters can be achieved from outside the library within ::IN_METADATA_SETUP input buffer. There is no need to supply meta data setup structure every frame. If there is no new meta setup data available, the encoder uses the previous setup or the default configuration in initial state.</p>
<p>In general the audio compressor and limiter within the encoder library can be configured with the ::AACENC_METADATA_DRC_PROFILE parameter <a class="el" href="struct_a_a_c_e_n_c___meta_data.html#a06cce4e89d53d956d27fb20892461aa0">AACENC_MetaData::drc_profile</a> and and <a class="el" href="struct_a_a_c_e_n_c___meta_data.html#a9274bda31c82bd154ddb3767b74be6b2">AACENC_MetaData::comp_profile</a>. <br  />
 </p>
<h1><a class="anchor" id="encReconf"></a>
Encoder Reconfiguration</h1>
<p>The encoder library allows reconfiguration of the encoder instance with new settings continuously between encoding frames. Each parameter to be changed must be set with a single aacEncoder_SetParam() call. The internal status of each parameter can be retrieved with an aacEncoder_GetParam() call.<br  />
 There is no stand-alone reconfiguration function available. When parameters were modified from outside the library, an internal control mechanism triggers the necessary reconfiguration process which will be applied at the beginning of the following aacEncEncode() call. This state can be observed from external via the AACENC_INIT_STATUS and aacEncoder_GetParam() function. The reconfiguration process can also be applied immediately when all parameters of an aacEncEncode() call are NULL with a valid encoder handle.<br  />
<br  />
 The internal reconfiguration process can be controlled from extern with the following access.</p><div class="fragment"><div class="line">aacEncoder_SetParam(hAacEncoder, AACENC_CONTROL_STATE, AACENC_CTRLFLAGS);</div>
</div><!-- fragment --><h1><a class="anchor" id="encParams"></a>
Encoder Parametrization</h1>
<p>All parameteres listed in ::AACENC_PARAM can be modified within an encoder instance.</p>
<h2><a class="anchor" id="encMandatory"></a>
Mandatory Encoder Parameters</h2>
<p>The following parameters must be specified when the encoder instance is initialized.</p><div class="fragment"><div class="line"> aacEncoder_SetParam(hAacEncoder, AACENC_AOT, value);</div>
<div class="line">aacEncoder_SetParam(hAacEncoder, AACENC_BITRATE, value);</div>
<div class="line">aacEncoder_SetParam(hAacEncoder, AACENC_SAMPLERATE, value);</div>
<div class="line">aacEncoder_SetParam(hAacEncoder, AACENC_CHANNELMODE, value);</div>
</div><!-- fragment --><p> Beyond that is an internal auto mode which preinitizializes the ::AACENC_BITRATE parameter if the parameter was not set from extern. The bitrate depends on the number of effective channels and sampling rate and is determined as follows. </p><div class="fragment"><div class="line">AAC-LC (<a class="code" href="_f_d_k__audio_8h.html#aa1570925f07a0866afc2681ce1408721abda162f68ce9d620587e3c5aab756312">AOT_AAC_LC</a>): 1.5 bits per sample</div>
<div class="line">HE-AAC (AOT_SBR): 0.625 bits per sample (dualrate sbr)</div>
<div class="line">HE-AAC (AOT_SBR): 1.125 bits per sample (downsampled sbr)</div>
<div class="line">HE-AAC v2 (<a class="code" href="_f_d_k__audio_8h.html#aa1570925f07a0866afc2681ce1408721afb6c5dc863da9b9dd0b752db6a1a70c8">AOT_PS</a>): 0.5 bits per sample</div>
<div class="ttc" id="a_f_d_k__audio_8h_html_aa1570925f07a0866afc2681ce1408721abda162f68ce9d620587e3c5aab756312"><div class="ttname"><a href="_f_d_k__audio_8h.html#aa1570925f07a0866afc2681ce1408721abda162f68ce9d620587e3c5aab756312">AOT_AAC_LC</a></div><div class="ttdeci">@ AOT_AAC_LC</div><div class="ttdef"><b>Definition:</b> FDK_audio.h:163</div></div>
<div class="ttc" id="a_f_d_k__audio_8h_html_aa1570925f07a0866afc2681ce1408721afb6c5dc863da9b9dd0b752db6a1a70c8"><div class="ttname"><a href="_f_d_k__audio_8h.html#aa1570925f07a0866afc2681ce1408721afb6c5dc863da9b9dd0b752db6a1a70c8">AOT_PS</a></div><div class="ttdeci">@ AOT_PS</div><div class="ttdef"><b>Definition:</b> FDK_audio.h:190</div></div>
</div><!-- fragment --><h2><a class="anchor" id="channelMode"></a>
Channel Mode Configuration</h2>
<p>The input audio data is described with the ::AACENC_CHANNELMODE parameter in the aacEncoder_SetParam() call. It is not possible to use the encoder instance with a 'number of input channels' argument. Instead, the channelMode must be set as follows.</p><div class="fragment"><div class="line">aacEncoder_SetParam(hAacEncoder, AACENC_CHANNELMODE, value);</div>
</div><!-- fragment --><p> The parameter is specified in <a class="el" href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683b">CHANNEL_MODE</a> and can be mapped from the number of input channels in the following way.</p><div class="fragment"><div class="line"> <a class="code" href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683b">CHANNEL_MODE</a> chMode =</div>
<div class="line">MODE_INVALID;</div>
<div class="line"> </div>
<div class="line"><span class="keywordflow">switch</span> (nChannels) {</div>
<div class="line">  <span class="keywordflow">case</span> 1:  chMode = <a class="code" href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683baf25f6bda513005f645d3626d9391f8cc">MODE_1</a>;          <span class="keywordflow">break</span>;</div>
<div class="line">  <span class="keywordflow">case</span> 2:  chMode = <a class="code" href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683ba0a36399f2feba688abe010c193b8a5f1">MODE_2</a>;          <span class="keywordflow">break</span>;</div>
<div class="line">  <span class="keywordflow">case</span> 3:  chMode = <a class="code" href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683ba1eebaef0988382d79e0d264c3fd9defc">MODE_1_2</a>;        <span class="keywordflow">break</span>;</div>
<div class="line">  <span class="keywordflow">case</span> 4:  chMode = <a class="code" href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683bab6ca6f471a746abdcca5a529097edbed">MODE_1_2_1</a>;      <span class="keywordflow">break</span>;</div>
<div class="line">  <span class="keywordflow">case</span> 5:  chMode = <a class="code" href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683bae962efe52de14327972236b2c3c8f952">MODE_1_2_2</a>;      <span class="keywordflow">break</span>;</div>
<div class="line">  <span class="keywordflow">case</span> 6:  chMode = <a class="code" href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683ba45a314be6a5d3d89c3ac82b6bbfff020">MODE_1_2_2_1</a>;    <span class="keywordflow">break</span>;</div>
<div class="line">  <span class="keywordflow">case</span> 7:  chMode = <a class="code" href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683bac96aa721750e7b04beb809ecf84a6796">MODE_6_1</a>;        <span class="keywordflow">break</span>;</div>
<div class="line">  <span class="keywordflow">case</span> 8:  chMode = <a class="code" href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683ba764f517e839e7c1972cee3adfc5dcc99">MODE_7_1_BACK</a>;   <span class="keywordflow">break</span>;</div>
<div class="line">  <span class="keywordflow">default</span>:</div>
<div class="line">    chMode = MODE_INVALID;</div>
<div class="line">}</div>
<div class="line"><span class="keywordflow">return</span> chMode;</div>
<div class="ttc" id="a_f_d_k__audio_8h_html_a4c03bad3dfc905ed83eb9d683495683b"><div class="ttname"><a href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683b">CHANNEL_MODE</a></div><div class="ttdeci">CHANNEL_MODE</div><div class="ttdef"><b>Definition:</b> FDK_audio.h:232</div></div>
<div class="ttc" id="a_f_d_k__audio_8h_html_a4c03bad3dfc905ed83eb9d683495683ba0a36399f2feba688abe010c193b8a5f1"><div class="ttname"><a href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683ba0a36399f2feba688abe010c193b8a5f1">MODE_2</a></div><div class="ttdeci">@ MODE_2</div><div class="ttdef"><b>Definition:</b> FDK_audio.h:236</div></div>
<div class="ttc" id="a_f_d_k__audio_8h_html_a4c03bad3dfc905ed83eb9d683495683ba1eebaef0988382d79e0d264c3fd9defc"><div class="ttname"><a href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683ba1eebaef0988382d79e0d264c3fd9defc">MODE_1_2</a></div><div class="ttdeci">@ MODE_1_2</div><div class="ttdef"><b>Definition:</b> FDK_audio.h:237</div></div>
<div class="ttc" id="a_f_d_k__audio_8h_html_a4c03bad3dfc905ed83eb9d683495683ba45a314be6a5d3d89c3ac82b6bbfff020"><div class="ttname"><a href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683ba45a314be6a5d3d89c3ac82b6bbfff020">MODE_1_2_2_1</a></div><div class="ttdeci">@ MODE_1_2_2_1</div><div class="ttdef"><b>Definition:</b> FDK_audio.h:240</div></div>
<div class="ttc" id="a_f_d_k__audio_8h_html_a4c03bad3dfc905ed83eb9d683495683ba764f517e839e7c1972cee3adfc5dcc99"><div class="ttname"><a href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683ba764f517e839e7c1972cee3adfc5dcc99">MODE_7_1_BACK</a></div><div class="ttdeci">@ MODE_7_1_BACK</div><div class="ttdef"><b>Definition:</b> FDK_audio.h:244</div></div>
<div class="ttc" id="a_f_d_k__audio_8h_html_a4c03bad3dfc905ed83eb9d683495683bab6ca6f471a746abdcca5a529097edbed"><div class="ttname"><a href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683bab6ca6f471a746abdcca5a529097edbed">MODE_1_2_1</a></div><div class="ttdeci">@ MODE_1_2_1</div><div class="ttdef"><b>Definition:</b> FDK_audio.h:238</div></div>
<div class="ttc" id="a_f_d_k__audio_8h_html_a4c03bad3dfc905ed83eb9d683495683bac96aa721750e7b04beb809ecf84a6796"><div class="ttname"><a href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683bac96aa721750e7b04beb809ecf84a6796">MODE_6_1</a></div><div class="ttdeci">@ MODE_6_1</div><div class="ttdef"><b>Definition:</b> FDK_audio.h:243</div></div>
<div class="ttc" id="a_f_d_k__audio_8h_html_a4c03bad3dfc905ed83eb9d683495683bae962efe52de14327972236b2c3c8f952"><div class="ttname"><a href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683bae962efe52de14327972236b2c3c8f952">MODE_1_2_2</a></div><div class="ttdeci">@ MODE_1_2_2</div><div class="ttdef"><b>Definition:</b> FDK_audio.h:239</div></div>
<div class="ttc" id="a_f_d_k__audio_8h_html_a4c03bad3dfc905ed83eb9d683495683baf25f6bda513005f645d3626d9391f8cc"><div class="ttname"><a href="_f_d_k__audio_8h.html#a4c03bad3dfc905ed83eb9d683495683baf25f6bda513005f645d3626d9391f8cc">MODE_1</a></div><div class="ttdeci">@ MODE_1</div><div class="ttdef"><b>Definition:</b> FDK_audio.h:235</div></div>
</div><!-- fragment --><h2><a class="anchor" id="peakbitrate"></a>
Peak Bitrate Configuration</h2>
<p>In AAC, the default bitreservoir configuration depends on the chosen bitrate per frame and the number of effective channels. The size can be determined as below. </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ bitreservoir = nEffChannels*6144 - (bitrate*framelength/samplerate) \]" src="form_0.png"/>
</p>
<p> Due to audio quality concerns it is not recommended to change the bitreservoir size to a lower value than the default setting! However, for minimizing the delay for streaming applications or for achieving a constant size of the bitstream packages in each frame, it may be necessaray to limit the maximum bits per frame size. This can be done with the ::AACENC_PEAK_BITRATE parameter.</p><div class="fragment"><div class="line">aacEncoder_SetParam(hAacEncoder, AACENC_PEAK_BITRATE, value);</div>
</div><!-- fragment --><p>To achieve acceptable audio quality with a reduced bitreservoir size setting at least 1000 bits per audio channel is recommended. For a multichannel audio file with 5.1 channels the bitreservoir reduced to 5000 bits results in acceptable audio quality.</p>
<h2><a class="anchor" id="vbrmode"></a>
Variable Bitrate Mode</h2>
<p>The variable bitrate (VBR) mode coding adapts the bit consumption to the psychoacoustic requirements of the signal. The encoder ignores the user-defined bit rate and selects a suitable pre-defined configuration based on the provided AOT. The VBR mode 1 is tuned for HE-AACv2, for VBR mode 2, HE-AACv1 should be used. VBR modes 3-5 should be used with Low-Complexity AAC. When encoding AAC-ELD, the best mode is selected automatically.</p>
<p>The bitrates given in the table are averages over time and different encoder settings. They strongly depend on the type of audio signal. The VBR configurations can be adjusted with the ::AACENC_BITRATEMODE encoder parameter. </p><pre class="fragment">-----------------------------------------------
 VBR_MODE | Approx. Bitrate in kbps for stereo
          |     AAC-LC    |      AAC-ELD
----------+---------------+--------------------
    VBR_1 | 32 (HE-AACv2) |         48
    VBR_2 | 72 (HE-AACv1) |         56
    VBR_3 |      112      |         72
    VBR_4 |      148      |        148
    VBR_5 |      228      |        224
--------------------------------------------
</pre><p> Note that these figures are valid for stereo encoding only. VBR modes 2-5 will yield much lower bit rates when encoding single-channel input. For configurations which are making use of downmix modules the AAC core channels respectively downmix channels shall be considered.</p>
<h2><a class="anchor" id="encQual"></a>
Audio Quality Considerations</h2>
<p>The default encoder configuration is suggested to be used. Encoder tools such as TNS and PNS are activated by default and are internally controlled (see <a class="el" href="_e_n_c_o_d_e_r_b_e_h_a_v_i_o_u_r.html#BEHAVIOUR_TOOLS">Encoder Tools</a>).</p>
<p>There is an additional quality parameter called ::AACENC_AFTERBURNER. In the default configuration this quality switch is deactivated because it would cause a workload increase which might be significant. If workload is not an issue in the application we recommended to activate this feature.</p><div class="fragment"><div class="line">aacEncoder_SetParam(hAacEncoder, AACENC_AFTERBURNER, 0/1); </div>
</div><!-- fragment --><h2><a class="anchor" id="encELD"></a>
ELD Auto Configuration Mode</h2>
<p>For ELD configuration a so called auto configurator is available which configures SBR and the SBR ratio by itself. The configurator is used when the encoder parameter ::AACENC_SBR_MODE and ::AACENC_SBR_RATIO are not set explicitly.</p>
<p>Based on sampling rate and chosen bitrate a reasonable SBR configuration will be used.</p><pre class="fragment">------------------------------------------------------------------
 Sampling Rate |   Total Bitrate | No. of | SBR |       SBR Ratio
     [kHz]     |      [bit/s]    |  Chan  |     |
               |                 |        |     |
---------------+-----------------+--------+-----+-----------------
     ]min, 16[ |    min -    max |      1 | off |             ---
---------------+-----------------+--------------+-----------------
          [16] |    min -  27999 |      1 |  on | downsampled SBR
               |  28000 -    max |      1 | off |             ---
---------------+-----------------+--------------+-----------------
     ]16 - 24] |    min -  39999 |      1 |  on | downsampled SBR
               |  40000 -    max |      1 | off |             ---
---------------+-----------------+--------------+-----------------
     ]24 - 32] |    min -  27999 |      1 |  on |    dualrate SBR
               |  28000 -  55999 |      1 |  on | downsampled SBR
               |  56000 -    max |      1 | off |             ---
---------------+-----------------+--------------+-----------------
   ]32 - 44.1] |    min -  63999 |      1 |  on |    dualrate SBR
               |  64000 -    max |      1 | off |             ---
---------------+-----------------+--------------+-----------------
   ]44.1 - 48] |    min -  63999 |      1 |  on |    dualrate SBR
               |  64000 -  max   |      1 | off |             ---
               |                 |        |     |
---------------+-----------------+--------+-----+-----------------
     ]min, 16[ |    min -    max |      2 | off |             ---
---------------+-----------------+--------------+-----------------
          [16] |    min -  31999 |      2 |  on | downsampled SBR
               |  32000 -  63999 |      2 |  on | downsampled SBR
               |  64000 -    max |      2 | off |             ---
---------------+-----------------+--------------+-----------------
     ]16 - 24] |    min -  47999 |      2 |  on | downsampled SBR
               |  48000 -  79999 |      2 |  on | downsampled SBR
               |  80000 -    max |      2 | off |             ---
---------------+-----------------+--------------+-----------------
     ]24 - 32] |    min -  31999 |      2 |  on |    dualrate SBR
               |  32000 -  67999 |      2 |  on |    dualrate SBR
               |  68000 -  95999 |      2 |  on | downsampled SBR
               |  96000 -    max |      2 | off |             ---
---------------+-----------------+--------------+-----------------
   ]32 - 44.1] |    min -  43999 |      2 |  on |    dualrate SBR
               |  44000 - 127999 |      2 |  on |    dualrate SBR
               | 128000 -    max |      2 | off |             ---
---------------+-----------------+--------------+-----------------
   ]44.1 - 48] |    min -  43999 |      2 |  on |    dualrate SBR
               |  44000 - 127999 |      2 |  on |    dualrate SBR
               | 128000 -  max   |      2 | off |             ---
               |                 |              |
------------------------------------------------------------------
</pre><h2><a class="anchor" id="encDsELD"></a>
Reduced Delay (Downscaled) Mode</h2>
<p>The downscaled mode of AAC-ELD reduces the algorithmic delay of AAC-ELD by virtually increasing the sampling rate. When using the downscaled mode, the bitrate should be increased for keeping the same audio quality level. For common signals, the bitrate should be increased by 25% for a downscale factor of 2.</p>
<p>Currently, downscaling factors 2 and 4 are supported. To enable the downscaled mode in the encoder, the framelength parameter AACENC_GRANULE_LENGTH must be set accordingly to 256 or 240 for a downscale factor of 2 or 128 or 120 for a downscale factor of 4. The default values of 512 or 480 mean that no downscaling is applied.</p><div class="fragment"><div class="line">aacEncoder_SetParam(hAacEncoder, AACENC_GRANULE_LENGTH, 256);</div>
<div class="line">aacEncoder_SetParam(hAacEncoder, AACENC_GRANULE_LENGTH, 128);</div>
</div><!-- fragment --><p>Downscaled bitstreams are fully backwards compatible. However, the legacy decoder needs to support high sample rate, e.g. 96kHz. The signaled sampling rate is multiplied by the downscale factor. Although not required, downscaling should be applied when decoding downscaled bitstreams. It reduces CPU workload and the output will have the same sampling rate as the input. In an ideal configuration both encoder and decoder should run with the same downscale factor.</p>
<p>The following table shows approximate filter bank delays in ms for common sampling rates(sr) at framesize(fs), and downscale factor(dsf), based on this formula: </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ 1000 * fs / (dsf * sr) \]" src="form_1.png"/>
</p>
<pre class="fragment">--------------------------------------
      | 512/2 | 512/4 | 480/2 | 480/4
------+-------+-------+-------+-------
22050 | 17.41 |  8.71 | 16.33 |  8.16
32000 | 12.00 |  6.00 | 11.25 |  5.62
44100 |  8.71 |  4.35 |  8.16 |  4.08
48000 |  8.00 |  4.00 |  7.50 |  3.75
--------------------------------------
</pre><h1><a class="anchor" id="audiochCfg"></a>
Audio Channel Configuration</h1>
<p>The MPEG standard refers often to the so-called Channel Configuration. This Channel Configuration is used for a fixed Channel Mapping. The configurations 1-7 and 11,12,14 are predefined in MPEG standard and used for implicit signalling within the encoded bitstream. For user defined Configurations the Channel Configuration is set to 0 and the Channel Mapping must be explecitly described with an appropriate Program Config Element. The present Encoder implementation does not allow the user to configure this Channel Configuration from extern. The Encoder implementation supports fixed Channel Modes which are mapped to Channel Configuration as follow.</p><pre class="fragment">----------------------------------------------------------------------------------------
 ChannelMode           | ChCfg | Height | front_El      | side_El  | back_El  |
lfe_El
-----------------------+-------+--------+---------------+----------+----------+---------
MODE_1                 |     1 | NORM   | SCE           |          |          |
MODE_2                 |     2 | NORM   | CPE           |          |          |
MODE_1_2               |     3 | NORM   | SCE, CPE      |          |          |
MODE_1_2_1             |     4 | NORM   | SCE, CPE      |          | SCE      |
MODE_1_2_2             |     5 | NORM   | SCE, CPE      |          | CPE      |
MODE_1_2_2_1           |     6 | NORM   | SCE, CPE      |          | CPE      |
LFE MODE_1_2_2_2_1         |     7 | NORM   | SCE, CPE, CPE |          | CPE
| LFE MODE_6_1               |    11 | NORM   | SCE, CPE      |          | CPE,
SCE | LFE MODE_7_1_BACK          |    12 | NORM   | SCE, CPE      |          |
CPE, CPE | LFE
-----------------------+-------+--------+---------------+----------+----------+---------
MODE_7_1_TOP_FRONT     |    14 | NORM   | SCE, CPE      |          | CPE      |
LFE |       | TOP    | CPE           |          |          |
-----------------------+-------+--------+---------------+----------+----------+---------
MODE_7_1_REAR_SURROUND |     0 | NORM   | SCE, CPE      |          | CPE, CPE |
LFE MODE_7_1_FRONT_CENTER  |     0 | NORM   | SCE, CPE, CPE |          | CPE
| LFE
----------------------------------------------------------------------------------------
- NORM: Normal Height Layer.     - TOP: Top Height Layer.  - BTM: Bottom Height
Layer.
- SCE: Single Channel Element.   - CPE: Channel Pair.      - LFE: Low Frequency
Element. </pre><p>The Table describes all fixed Channel Elements for each Channel Mode which are assigned to a speaker arrangement. The arrangement includes front, side, back and lfe Audio Channel Elements in the normal height layer, possibly followed by front, side, and back elements in the top and bottom layer (Channel Configuration 14). <br  />
 This mapping of Audio Channel Elements is defined in MPEG standard for Channel Config 1-7 and 11,12,14.<br  />
 In case of Channel Config 0 or writing matrix mixdown coefficients, the encoder enables the writing of Program Config Element itself as described in encPCE. The configuration used in Program Config Element refers to the denoted Table.<br  />
 Beside the Channel Element assignment the Channel Modes are resposible for audio input data channel mapping. The Channel Mapping of the audio data depends on the selected ::AACENC_CHANNELORDER which can be MPEG or WAV like order.<br  />
 Following table describes the complete channel mapping for both Channel Order configurations. </p><pre class="fragment">---------------------------------------------------------------------------------------
ChannelMode            |  MPEG-Channelorder            |  WAV-Channelorder
-----------------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---
MODE_1                 | 0 |   |   |   |   |   |   |   | 0 |   |   |   |   |   |
| MODE_2                 | 0 | 1 |   |   |   |   |   |   | 0 | 1 |   |   |   |
|   | MODE_1_2               | 0 | 1 | 2 |   |   |   |   |   | 2 | 0 | 1 |   |
|   |   | MODE_1_2_1             | 0 | 1 | 2 | 3 |   |   |   |   | 2 | 0 | 1 | 3
|   |   |   | MODE_1_2_2             | 0 | 1 | 2 | 3 | 4 |   |   |   | 2 | 0 | 1
| 3 | 4 |   |   | MODE_1_2_2_1           | 0 | 1 | 2 | 3 | 4 | 5 |   |   | 2 | 0
| 1 | 4 | 5 | 3 |   | MODE_1_2_2_2_1         | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 2
| 6 | 7 | 0 | 1 | 4 | 5 | 3 MODE_6_1               | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
| 2 | 0 | 1 | 4 | 5 | 6 | 3 | MODE_7_1_BACK          | 0 | 1 | 2 | 3 | 4 | 5 | 6
| 7 | 2 | 0 | 1 | 6 | 7 | 4 | 5 | 3 MODE_7_1_TOP_FRONT     | 0 | 1 | 2 | 3 | 4 |
5 | 6 | 7 | 2 | 0 | 1 | 4 | 5 | 3 | 6 | 7
-----------------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---
MODE_7_1_REAR_SURROUND | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 2 | 0 | 1 | 6 | 7 | 4 |
5 | 3 MODE_7_1_FRONT_CENTER  | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 2 | 6 | 7 | 0 | 1
| 4 | 5 | 3
---------------------------------------------------------------------------------------
</pre><p>The denoted mapping is important for correct audio channel assignment when using MPEG or WAV ordering. The incoming audio channels are distributed MPEG like starting at the front channels and ending at the back channels. The distribution is used as described in Table concering Channel Config and fix channel elements. Please see the following example for clarification.</p>
<pre class="fragment">Example: MODE_1_2_2_1 - WAV-Channelorder 5.1
------------------------------------------
 Input Channel      | Coder Channel
--------------------+---------------------
 2 (front center)   | 0 (SCE channel)
 0 (left center)    | 1 (1st of 1st CPE)
 1 (right center)   | 2 (2nd of 1st CPE)
 4 (left surround)  | 3 (1st of 2nd CPE)
 5 (right surround) | 4 (2nd of 2nd CPE)
 3 (LFE)            | 5 (LFE)
------------------------------------------
</pre><h1><a class="anchor" id="suppBitrates"></a>
Supported Bitrates</h1>
<p>The FDK AAC Encoder provides a wide range of supported bitrates. The minimum and maximum allowed bitrate depends on the Audio Object Type. For AAC-LC the minimum bitrate is the bitrate that is required to write the most basic and minimal valid bitstream. It consists of the bitstream format header information and other static/mandatory information within the AAC payload. The maximum AAC framesize allowed by the MPEG-4 standard determines the maximum allowed bitrate for AAC-LC. For HE-AAC and HE-AAC v2 a library internal look-up table is used.</p>
<p>A good working point in terms of audio quality, sampling rate and bitrate, is at 1 to 1.5 bits/audio sample for AAC-LC, 0.625 bits/audio sample for dualrate HE-AAC, 1.125 bits/audio sample for downsampled HE-AAC and 0.5 bits/audio sample for HE-AAC v2. For example for one channel with a sampling frequency of 48 kHz, the range from 48 kbit/s to 72 kbit/s achieves reasonable audio quality for AAC-LC.</p>
<p>For HE-AAC and HE-AAC v2 the lowest possible audio input sampling frequency is 16 kHz because then the AAC-LC core encoder operates in dual rate mode at its lowest possible sampling frequency, which is 8 kHz. HE-AAC v2 requires stereo input audio data.</p>
<p>Please note that in HE-AAC or HE-AAC v2 mode the encoder supports much higher bitrates than are appropriate for HE-AAC or HE-AAC v2. For example, at a bitrate of more than 64 kbit/s for a stereo audio signal at 44.1 kHz it usually makes sense to use AAC-LC, which will produce better audio quality at that bitrate than HE-AAC or HE-AAC v2.</p>
<h1><a class="anchor" id="reommendedConfig"></a>
Recommended Sampling Rate and Bitrate Combinations</h1>
<p>The following table provides an overview of recommended encoder configuration parameters which we determined by virtue of numerous listening tests.</p>
<h2><a class="anchor" id="reommendedConfigLC"></a>
AAC-LC, HE-AAC, HE-AACv2 in Dualrate SBR mode.</h2>
<pre class="fragment">-----------------------------------------------------------------------------------
Audio Object Type  |  Bit Rate Range  |            Supported  | Preferred  | No.
of |         [bit/s]  |       Sampling Rates  |    Sampl.  |  Chan. |
|                [kHz]  |      Rate  | |                  |
|     [kHz]  |
-------------------+------------------+-----------------------+------------+-------
AAC LC + SBR + PS  |   8000 -  11999  |         22.05, 24.00  |     24.00  | 2
AAC LC + SBR + PS  |  12000 -  17999  |                32.00  |     32.00  | 2
AAC LC + SBR + PS  |  18000 -  39999  |  32.00, 44.10, 48.00  |     44.10  | 2
AAC LC + SBR + PS  |  40000 -  64000  |  32.00, 44.10, 48.00  |     48.00  | 2
-------------------+------------------+-----------------------+------------+-------
AAC LC + SBR       |   8000 -  11999  |         22.05, 24.00  |     24.00  | 1
AAC LC + SBR       |  12000 -  17999  |                32.00  |     32.00  | 1
AAC LC + SBR       |  18000 -  39999  |  32.00, 44.10, 48.00  |     44.10  | 1
AAC LC + SBR       |  40000 -  64000  |  32.00, 44.10, 48.00  |     48.00  | 1
-------------------+------------------+-----------------------+------------+-------
AAC LC + SBR       |  16000 -  27999  |  32.00, 44.10, 48.00  |     32.00  | 2
AAC LC + SBR       |  28000 -  63999  |  32.00, 44.10, 48.00  |     44.10  | 2
AAC LC + SBR       |  64000 - 128000  |  32.00, 44.10, 48.00  |     48.00  | 2
-------------------+------------------+-----------------------+------------+-------
AAC LC + SBR       |  64000 -  69999  |  32.00, 44.10, 48.00  |     32.00  |
5, 5.1 AAC LC + SBR       |  70000 - 239999  |  32.00, 44.10, 48.00  |     44.10
| 5, 5.1 AAC LC + SBR       | 240000 - 319999  |  32.00, 44.10, 48.00  |
48.00  | 5, 5.1
-------------------+------------------+-----------------------+------------+-------
AAC LC             |   8000 -  15999  | 11.025, 12.00, 16.00  |     12.00  | 1
AAC LC             |  16000 -  23999  |                16.00  |     16.00  | 1
AAC LC             |  24000 -  31999  |  16.00, 22.05, 24.00  |     24.00  | 1
AAC LC             |  32000 -  55999  |                32.00  |     32.00  | 1
AAC LC             |  56000 - 160000  |  32.00, 44.10, 48.00  |     44.10  | 1
AAC LC             | 160001 - 288000  |                48.00  |     48.00  | 1
-------------------+------------------+-----------------------+------------+-------
AAC LC             |  16000 -  23999  | 11.025, 12.00, 16.00  |     12.00  | 2
AAC LC             |  24000 -  31999  |                16.00  |     16.00  | 2
AAC LC             |  32000 -  39999  |  16.00, 22.05, 24.00  |     22.05  | 2
AAC LC             |  40000 -  95999  |                32.00  |     32.00  | 2
AAC LC             |  96000 - 111999  |  32.00, 44.10, 48.00  |     32.00  | 2
AAC LC             | 112000 - 320001  |  32.00, 44.10, 48.00  |     44.10  | 2
AAC LC             | 320002 - 576000  |                48.00  |     48.00  | 2
-------------------+------------------+-----------------------+------------+-------
AAC LC             | 160000 - 239999  |                32.00  |     32.00  |
5, 5.1 AAC LC             | 240000 - 279999  |  32.00, 44.10, 48.00  |     32.00
| 5, 5.1 AAC LC             | 280000 - 800000  |  32.00, 44.10, 48.00  |
44.10  | 5, 5.1
-----------------------------------------------------------------------------------
</pre><p> <br  />
 </p>
<h2><a class="anchor" id="reommendedConfigLD"></a>
AAC-LD, AAC-ELD, AAC-ELD with SBR in Dualrate SBR</h2>
<p>mode. Unlike to HE-AAC configuration the SBR is not covered by ELD audio object type and needs to be enabled explicitly. Use ::AACENC_SBR_MODE to configure SBR and its samplingrate ratio with ::AACENC_SBR_RATIO parameter.</p><pre class="fragment">-----------------------------------------------------------------------------------
Audio Object Type  |  Bit Rate Range  |            Supported  | Preferred  | No.
of |         [bit/s]  |       Sampling Rates  |    Sampl.  |  Chan. |
|                [kHz]  |      Rate  | |                  |
|     [kHz]  |
-------------------+------------------+-----------------------+------------+-------
ELD + SBR          |  18000 -  24999  |        32.00 - 44.10  |     32.00  | 1
ELD + SBR          |  25000 -  31999  |        32.00 - 48.00  |     32.00  | 1
ELD + SBR          |  32000 -  64000  |        32.00 - 48.00  |     48.00  | 1
-------------------+------------------+-----------------------+------------+-------
ELD + SBR          |  32000 -  51999  |        32.00 - 48.00  |     44.10  | 2
ELD + SBR          |  52000 - 128000  |        32.00 - 48.00  |     48.00  | 2
-------------------+------------------+-----------------------+------------+-------
ELD + SBR          |  78000 - 160000  |        32.00 - 48.00  |     48.00  | 3
-------------------+------------------+-----------------------+------------+-------
ELD + SBR          | 104000 - 212000  |        32.00 - 48.00  |     48.00  | 4
-------------------+------------------+-----------------------+------------+-------
ELD + SBR          | 130000 - 246000  |        32.00 - 48.00  |     48.00  |
5, 5.1
-------------------+------------------+-----------------------+------------+-------
LD, ELD            |  16000 -  19999  |        16.00 - 24.00  |     16.00  | 1
LD, ELD            |  20000 -  39999  |        16.00 - 32.00  |     24.00  | 1
LD, ELD            |  40000 -  49999  |        22.05 - 32.00  |     32.00  | 1
LD, ELD            |  50000 -  61999  |        24.00 - 44.10  |     32.00  | 1
LD, ELD            |  62000 -  84999  |        32.00 - 48.00  |     44.10  | 1
LD, ELD            |  85000 - 192000  |        44.10 - 48.00  |     48.00  | 1
-------------------+------------------+-----------------------+------------+-------
LD, ELD            |  64000 -  75999  |        24.00 - 32.00  |     32.00  | 2
LD, ELD            |  76000 -  97999  |        24.00 - 44.10  |     32.00  | 2
LD, ELD            |  98000 - 135999  |        32.00 - 48.00  |     44.10  | 2
LD, ELD            | 136000 - 384000  |        44.10 - 48.00  |     48.00  | 2
-------------------+------------------+-----------------------+------------+-------
LD, ELD            |  96000 - 113999  |        24.00 - 32.00  |     32.00  | 3
LD, ELD            | 114000 - 146999  |        24.00 - 44.10  |     32.00  | 3
LD, ELD            | 147000 - 203999  |        32.00 - 48.00  |     44.10  | 3
LD, ELD            | 204000 - 576000  |        44.10 - 48.00  |     48.00  | 3
-------------------+------------------+-----------------------+------------+-------
LD, ELD            | 128000 - 151999  |        24.00 - 32.00  |     32.00  | 4
LD, ELD            | 152000 - 195999  |        24.00 - 44.10  |     32.00  | 4
LD, ELD            | 196000 - 271999  |        32.00 - 48.00  |     44.10  | 4
LD, ELD            | 272000 - 768000  |        44.10 - 48.00  |     48.00  | 4
-------------------+------------------+-----------------------+------------+-------
LD, ELD            | 160000 - 189999  |        24.00 - 32.00  |     32.00  |
5, 5.1 LD, ELD            | 190000 - 244999  |        24.00 - 44.10  |     32.00
| 5, 5.1 LD, ELD            | 245000 - 339999  |        32.00 - 48.00  |
44.10  | 5, 5.1 LD, ELD            | 340000 - 960000  |        44.10 - 48.00  |
48.00  | 5, 5.1
-----------------------------------------------------------------------------------
</pre><p> <br  />
 </p>
<h2><a class="anchor" id="reommendedConfigELD"></a>
AAC-ELD with SBR in Downsampled SBR mode.</h2>
<pre class="fragment">-----------------------------------------------------------------------------------
Audio Object Type  |  Bit Rate Range  |            Supported  | Preferred  | No.
of |         [bit/s]  |       Sampling Rates  |    Sampl.  |  Chan. |
|                [kHz]  |      Rate  | |                  |
|     [kHz]  |
-------------------+------------------+-----------------------+------------+-------
ELD + SBR          |  18000 - 24999   |        16.00 - 22.05  |     22.05  | 1
(downsampled SBR)  |  25000 - 31999   |        16.00 - 24.00  |     24.00  | 1
                   |  32000 - 47999   |        22.05 - 32.00  |     32.00  | 1
                   |  48000 - 64000   |        22.05 - 48.00  |     32.00  | 1
-------------------+------------------+-----------------------+------------+-------
ELD + SBR          |  32000 - 51999   |        16.00 - 24.00  |     24.00  | 2
(downsampled SBR)  |  52000 - 59999   |        22.05 - 24.00  |     24.00  | 2
                   |  60000 - 95999   |        22.05 - 32.00  |     32.00  | 2
                   |  96000 - 128000  |        22.05 - 48.00  |     32.00  | 2
-------------------+------------------+-----------------------+------------+-------
ELD + SBR          |  78000 -  99999  |        22.05 - 24.00  |     24.00  | 3
(downsampled SBR)  | 100000 - 143999  |        22.05 - 32.00  |     32.00  | 3
                   | 144000 - 159999  |        22.05 - 48.00  |     32.00  | 3
                   | 160000 - 192000  |        32.00 - 48.00  |     32.00  | 3
-------------------+------------------+-----------------------+------------+-------
ELD + SBR          | 104000 - 149999  |        22.05 - 24.00  |     24.00  | 4
(downsampled SBR)  | 150000 - 191999  |        22.05 - 32.00  |     32.00  | 4
                   | 192000 - 211999  |        22.05 - 48.00  |     32.00  | 4
                   | 212000 - 256000  |        32.00 - 48.00  |     32.00  | 4
-------------------+------------------+-----------------------+------------+-------
ELD + SBR          | 130000 - 171999  |        22.05 - 24.00  |     24.00  |
5, 5.1 (downsampled SBR)  | 172000 - 239999  |        22.05 - 32.00  |     32.00
| 5, 5.1 | 240000 - 320000  |        32.00 - 48.00  |     32.00  | 5, 5.1
-----------------------------------------------------------------------------------
</pre><p> <br  />
 </p>
<h2><a class="anchor" id="reommendedConfigELDv2"></a>
AAC-ELD v2, AAC-ELD v2 with SBR.</h2>
<p>The ELD v2 212 configuration must be configured explicitly with ::AACENC_CHANNELMODE parameter according MODE_212 value. SBR can be configured separately through ::AACENC_SBR_MODE and ::AACENC_SBR_RATIO parameter. Following configurations shall apply to both framelengths 480 and 512. For ELD v2 configuration without SBR and framelength 480 the supported sampling rate is restricted to the range from 16 kHz up to 24 kHz.</p><pre class="fragment">-----------------------------------------------------------------------------------
Audio Object Type  |  Bit Rate Range  |            Supported  | Preferred  | No.
of |         [bit/s]  |       Sampling Rates  |    Sampl.  |  Chan. |
|                [kHz]  |      Rate  | |                  |
|     [kHz]  |
-------------------+------------------+-----------------------+------------+-------
ELD-212            |  16000 -  19999  |        16.00 - 24.00  |     16.00  | 2
(without SBR)      |  20000 -  39999  |        16.00 - 32.00  |     24.00  | 2
                   |  40000 -  49999  |        22.05 - 32.00  |     32.00  | 2
                   |  50000 -  61999  |        24.00 - 44.10  |     32.00  | 2
                   |  62000 -  84999  |        32.00 - 48.00  |     44.10  | 2
                   |  85000 - 192000  |        44.10 - 48.00  |     48.00  | 2
-------------------+------------------+-----------------------+------------+-------
ELD-212 + SBR      |  18000 -  20999  |                32.00  |     32.00  | 2
(dualrate SBR)     |  21000 -  25999  |        32.00 - 44.10  |     32.00  | 2
                   |  26000 -  31999  |        32.00 - 48.00  |     44.10  | 2
                   |  32000 -  64000  |        32.00 - 48.00  |     48.00  | 2
-------------------+------------------+-----------------------+------------+-------
ELD-212 + SBR      |  18000 -  19999  |        16.00 - 22.05  |     22.05  | 2
(downsampled SBR)  |  20000 -  24999  |        16.00 - 24.00  |     22.05  | 2
                   |  25000 -  31999  |        16.00 - 24.00  |     24.00  | 2
                   |  32000 -  64000  |        24.00 - 24.00  |     24.00  | 2
-------------------+------------------+-----------------------+------------+-------
</pre><p> <br  />
</p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
